$(function() {
    //先去逛逛
    $(".look").on("click",function() {
        location.href = "../../index.html";
    })
    function tips(tips) {
        $(".tips").css("display", "block").html(tips).animate({
            "opacity": 1
        }, 1000, function () {
            setTimeout(function () {
                $(".tips").animate({
                    "opacity": 0
                }, 1000, function () {
                    $(".tips").css("display", "none");
                })
            }, 1000);
        })
    }
    $(".loginBtn").on("click",function(){
        //获取用户名和密码
        var userName = $(".loginName").val();
        var password = $(".psd").val();
        $.ajax({
            type: "post",
            url: domain.test + "/getlogin",
            data: {
                userName:userName,
                password:password,
                pushId:"sir555",
                os:"iOS"
            },
            dataType:"json",
            success: function (response) {
                console.log(response);
               if(response.data.rtnCode===200) {
                   console.log(response);
                   var userData = response.data.data;
                   localStorage.token = userData.token;
                   localStorage.userHeadPic = userData.pic;
                   localStorage.userName = userData.userName;
                   localStorage.nickname = userData.nickname;
                   localStorage.userMobile = userData.mobile
                   localStorage.gender = userData.sex;
                   localStorage.birthday = userData.birthday;
                   location.href = "../me/me.html";
               }
               if(response.data.rtnCode===462) {
                   tips(response.data.msg);
               }
            }
        });
    });
});